<?php
/**
 * Created by PhpStorm.
 * User: zhangyi
 * Date: 17/3/11
 * Time: 下午12:13
 */
namespace backend\controllers;

use app\models\Notice;
use Yii;
use app\models\Singlepage;


class CompanyController extends BaseInterfaceController
{
    public function actionDisclaimer()
    {

        $model = Singlepage::findOne(Singlepage::PAGE_DISCLAIMER);
        $this->content = array(
            'detail'=>$this->safe($model->content),
        );
        return $this->outputJson();
    }

    public function actionProfile()
    {

        $model = Singlepage::findOne(Singlepage::PAGE_PROFILE);
        $this->content = array(
            'detail'=>$this->safe($model->content),
        );
        return $this->outputJson();
    }
    public function actionActivity()
    {
        $type = $this->originData['type'];
        $models = Notice::find()->where(['type'=>$type])->orderBy('sort desc')->all();
        $data = array();
        foreach($models as $index=>$model) {
            $data[$index] = array(
                'detail'=>$this->safe($model->content),
                'desc'=>$this->safe($model->title),
            );
        }
        $this->content = array(
            'list'=>$data,
        );
        return $this->outputJson();
    }
}